package com.alisiwei.util;

import java.util.Map;

/**
 * 描述：日志打印相关工具
 * 作者：zhangkai
 * 日期：2017-7-21
 */
public class Logutil {
	
	/**
	 * 描述：换行格式输出字符串数组
	 * 作者：zhangkai
	 * @param strArray
	 * @return
	 */
	public static String printStringArray(String[] strArray) throws Exception {
		String result = "{\n";
		if (strArray != null && strArray.length > 0) {
			for (int i = 0; i < strArray.length; i++) {
				result += strArray[i]+"\n";
			}
		}
		result += "}";
		return result;
	}
	
	/**
	 * 描述：换行输出map
	 * 作者：zhangkai
	 * @param map
	 * @return
	 */
	public static String printMap(Map<String, Object> map) throws Exception {
		String result = "{\n";
		for (Map.Entry<String, Object> entry : map.entrySet()) {
			result += entry.getKey() +"："+ entry.getValue() +"\n";
		}
		result += "}";
		return result;
	}
	public static void main(String[] args) {
//		String[] a = {"abd","ksd","dfe","wewe"};
//		System.out.println("换行结果："+printStringArray(a));
//		Map<String, Object> map = new HashMap<String, Object>();
//		map.put("1", "abd");
//		map.put("2", "abd");
//		map.put("3", "abd");
//		map.put("4", "abd");
//		System.out.println("换行结果："+printMap(map));
	}
}
